package com.anosine.gpsl.android.alarm;

import com.anosine.gpsl.android.ui.activity.GPSLMainActivity;
import com.anosine.gpsl.android.ui.fragment.TabMonitoringFragmentNew;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;


/**
 * @Title: UploadPOIService
 * @Package com.anosine.gpsl.android.alarm
 * @Description: 
 * @author: sunny
 * @date: 2015-12-14
 * @version V1.0
 */
public class UploadPOIService extends Service implements Runnable{
    private String TAG = UploadPOIService.class.getSimpleName();
    /**
   	 * @Title: onCreate() 
   	 * @Description: 初始化
   	 * @param: 无
   	 * @return: 无
   	 * @throws
   	 */
    @Override
    public void onCreate() {
        super.onCreate();
        uploadPOIInfo();
    }
    /**
   	 * @Title: onDestroy() 
   	 * @Description: 销毁
   	 * @param: 无
   	 * @return: 无
   	 * @throws
   	 */
    @Override
    public void onDestroy() {
        super.onDestroy();
    }
    /**
   	 * @Title: uploadPOIInfo() 
   	 * @Description: 
   	 * @param: 无
   	 * @return: 无
   	 * @throws
   	 */
    private void uploadPOIInfo() {
    	//simulation HTTP request to server 
    	new Thread(this).start();
    }
    
	@Override
	public IBinder onBind(Intent intent) {
		return null;
	}
	 /**
   	 * @Title: run() 
   	 * @Description: 重写run()方法
   	 * @param: 无
   	 * @return: 无
   	 * @throws
   	 */
	@Override
	public void run() {
		try {
			
			TabMonitoringFragmentNew m = TabMonitoringFragmentNew.getMainInstance();
			if (m != null) {
				m.sendGetHttpPositon();			
			}
			Thread.sleep(10*1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		stopSelf();
		
	}

}
